package com.zhongyu.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhongyu.pojo.CangkuKucun;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface CangkuKuCunMapper extends BaseMapper<CangkuKucun> {

    @Select("select t1.*,t2.id ,t2.*,t3.id,t3.* from smbms_cangku_kucun t1\n" +
            "left  join smbms_cangku t2\n" +
            " on t1.cangku_id=t2.id\n " +
            "left join  smbms_goods t3 on t1.goods_id=t3.id ${ew.customSqlSegment}")
    @ResultMap("kucunRm")
    List<CangkuKucun> findAll(Page page , @Param("ew") Wrapper wrapper);


    @Select("select * from smbms_cangku_kucun WHERE  goods_id=#{goodsId} AND cangku_id=#{cangkuId}")
    List<CangkuKucun>getList(CangkuKucun cangkuKucun, Integer goodsId, Integer cangkuId);

}
